home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / WindowPort.h < prev    next >
C/C++ Source or Header  |  1992-08-19  |  4KB  |  137 lines

  1. #ifndef WindowPort_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define WindowPort_First
  7.  
  8. #include "Port.h"
  9. #include "WindowSystem.h"
  10.  
  11. class Window;
  12. class Region;
  13. class RGB;
  14. class WindowColorMap;
  15.  
  16. enum WinState {
  17.     eWsHidden,    // window allocated but not in hierarchy
  18.     eWsShown,     // window is inserted in window hierarchy
  19.     eWsIconic,
  20.     eWsClosed     // window will be removed
  21. };
  22.  
  23. class WindowPort: public Port {
  24. protected:
  25.     Window *win;
  26.     Token pushbacktoken;
  27.     bool havepushbacktoken, overlay, exitloop;
  28.     GrCursor cursor;
  29.     WinState state;
  30.     Region *inval;
  31.     Point lastpos;
  32.     Rectangle portrect;
  33.     WindowColorMap *wcmap;
  34.     
  35.     //---- overridden ----------------------------------------------------
  36.     bool DevImageCacheBegin(ImageCache*, Rectangle);
  37.     void DevImageCacheEnd(ImageCache*);
  38.     //--------------------------------------------------------------------
  39.     
  40.     void OpenNotify(Rectangle r);
  41.     void CloseNotify();
  42.  
  43. public:
  44.     MetaDef(WindowPort);
  45.     WindowPort(Window *bw, WindowType wt, GrCursor curs);
  46.     ~WindowPort();
  47.  
  48.     //---- device dependent stuff ----------------------------------------
  49.     virtual void DevUpdate();
  50.  
  51.     virtual void DevFullscreen(bool);
  52.     virtual void DevScrollRect(Rectangle, Point);
  53.     virtual void DevHide();
  54.     virtual void DevIconize();
  55.     virtual void DevShow(WindowPort *father, Rectangle);
  56.     virtual void DevGrab(bool, bool);
  57.     virtual void DevGetEvent(Token *t, int timeout, bool overread);    
  58.     virtual void DevSetMousePos(Point, bool);
  59.     virtual void DevBell(long d);
  60.     virtual void DevTop(bool);
  61.     virtual void DevSetCursor(GrCursor);
  62.     virtual void DevSetExtent(Point);
  63.     virtual void DevSetOrigin(Point);
  64.     virtual Rectangle DevGetRect();
  65.     virtual void DevSetTitle(char*);
  66.  
  67.     void DevSetColor(RGBColor *cp);
  68.     virtual void DevSetColor2(u_long id);
  69.     //---- end of device dependent stuff ---------------------------------
  70.     
  71.     //---- window management ---------------------------------------------
  72.     void Top()      // bring window to top of window stack
  73.     { DevTop(TRUE); }
  74.     void Bottom()   // bring window to bottom of window stack
  75.     { DevTop(FALSE); }
  76.     void Hide();    // remove a window temporary from the screen
  77.     void Show(WindowPort *father, Rectangle, bool block);
  78.             // reinsert a previously hidden window
  79.     void Iconize();
  80.     void UpdateRect(Rectangle &r);
  81.     
  82.     void SetTitle(char *title)
  83.     { DevSetTitle(title); }
  84.  
  85.     //---- size management -----------------------------------------------
  86.     Rectangle GetRect()
  87.     { return DevGetRect(); }
  88.     void SetOrigin(Point o)
  89.     { DevSetOrigin(o); }
  90.     void SetExtent(Point e)
  91.     { DevSetExtent(e); }
  92.  
  93.     //---- scrolling -------------------------------------------------------
  94.     void Scroll(Point);
  95.     void InvalidateRect(const Rectangle &r, bool update= FALSE);
  96.  
  97.     //---- input handling ------------------------------------------------
  98.     void InputNotify(Token *t);
  99.     void GetEvent(Token *t, int timeout= -1, bool overread= TRUE);    
  100.                     // read next event
  101.     
  102.     void PushEvent(Token t); 
  103.     
  104.     void Grab(bool m, bool fs);     // get all input events (fs = fullscreen)
  105.  
  106.     void SetMousePos(Point p)       // set the mouse position in window
  107.     { DevSetMousePos(p, FALSE); }      // relative coordinates
  108.     
  109.     void MoveMousePos(Point delta)  // move the mouse position
  110.     { DevSetMousePos(delta, TRUE); }
  111.     
  112.     void Bell(long d)               // ring the bell
  113.     { DevBell(d); }
  114.  
  115.     void GrabLoop();
  116.     void Poll(int timeout= 300);
  117.     void ExitLoop()
  118.     { exitloop= TRUE; }
  119.     
  120.     WindowColorMap *ColorMap()
  121.     { return wcmap; }
  122.     void FlushColorMap();
  123.  
  124.     //---- cursor stuff --------------------------------------------------
  125.     GrCursor GetCursor();
  126.     GrCursor SetWaitCursor(unsigned int d= 400, GrCursor c= eCrsHourglass);
  127.     GrCursor SetCursor(GrCursor);
  128. };
  129.  
  130. struct batchInfo {
  131.     class DevBitmap *b;
  132.     Rectangle r;
  133.     Point p;
  134. };
  135.  
  136. #endif
  137.